package com.slz3.business.module.configManagement.conVersion.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conVersion.domain.ConVersion;
import com.slz3.business.module.configManagement.conVersion.domain.ConVersionFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConVersionTransactionalServiceImpl implements ConVersionTransactionalService {

    @Override
    public ConVersion modify(ConVersion conVersionNew) {
        Repositorys.conVersion.test();
        Repositorys.conVersion.save(ConVersionFactory.initBaseFields());
        System.err.println(1/0);
        conVersionNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conVersion.saveAndFlush(conVersionNew);
    }

    @Override
    public List<ConVersion> batchModify(List<ConVersion> conVersionList) {
        return Repositorys.conVersion.saveAll(conVersionList);
    }
}
